package com.ming.elm.service.impl;

import java.util.List;

import com.ming.elm.dao.BusinessDao;
import com.ming.elm.po.Business;
import com.ming.elm.service.BusinessService;
import com.ming.elm.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

public class BusinessServiceImpl implements BusinessService {

	// 根据分类Id查询商家信息
	@Override
	public List<Business> listBusinessByOrderTypeId(Integer orderTypeId) {
		List<Business> list = null;
		SqlSession sqlSession = MybatisUtil.getSqlSession();
		BusinessDao mapper = sqlSession.getMapper(BusinessDao.class);
		try {
			list = mapper.listBusinessByOrderTypeId(orderTypeId);
		} catch (Exception e) {
			e.printStackTrace();
		}
		sqlSession.close();

		return list;
	}

	// 根据商家Id查询商家信息
	@Override
	public Business getBusinessById(Integer businessId) {
		Business business = null;
		SqlSession sqlSession = MybatisUtil.getSqlSession();
		BusinessDao mapper = sqlSession.getMapper(BusinessDao.class);
		try {
			business = mapper.getBusinessById(businessId);
		} catch (Exception e) {
			e.printStackTrace();
		}
		sqlSession.close();

		return business;
	}
}
